Skip to content

Conversation

@themouette
Copy link

Fixes #5
Replaces #6

It is helpful to release a library that uses css-modules.

To combine all css files in a single file, give its name:

{
    "plugins": [
        [
            "css-modules-transform", {
                "extractCss": "./dist/stylesheets/combined.css"
            }
        ]
    ]
}

To extract all files in a single directory, give an object:

{
    "plugins": [
        [
            "css-modules-transform", {
                "extractCss": {
                    dir: "./dist/stylesheets/",
                    relativeRoot: "./src/",
                    filename: "[path]/[name].css"
                }
            }
        ]
    ]
}

@themouette
Copy link
Author

I did a followup on #6
Without your previous work I would never have been able

It works for my usage, and given the tests, it seems it works in other cases.

WDYT?

@themouette themouette force-pushed the extract-css-to-file branch 2 times, most recently from 0135ce4 to 79352f5 Compare August 1, 2016 22:16
});

// wrap or define processCss function that collect generated css
currentConfig.processCss = pushStylesCreator(currentConfig.processCss);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that processCss is not transforming css in some way and returns it? Because if so then we need to update pushStylesCreator to reflect those changes before css is passed to extractCssFile.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed.

I updated pushStylesCreator to use processCss return value if it is a string.

@michalkvasnicak
Copy link
Owner

Great PR, thank you! 👍 There is only this one question from me.

When we'll be sure that processCss is not transforming css or we will reflect those changes I'll merge this.

@themouette themouette force-pushed the extract-css-to-file branch from 79352f5 to 072fffc Compare August 2, 2016 07:45
Fixes michalkvasnicak#5
Replaces michalkvasnicak#6

It is helpful to release a library that uses css-modules.

To combine all css files in a single file, give its name:

```
{
    "plugins": [
        [
            "css-modules-transform", {
                "extractCss": "./dist/stylesheets/combined.css"
            }
        ]
    ]
}
```

To extract all files in a single directory, give an object:

```
{
    "plugins": [
        [
            "css-modules-transform", {
                "extractCss": {
                    dir: "./dist/stylesheets/",
                    relativeRoot: "./src/",
                    filename: "[path]/[name].css"
                }
            }
        ]
    ]
}
```
@themouette themouette force-pushed the extract-css-to-file branch from 072fffc to 18118ae Compare August 2, 2016 07:48
@michalkvasnicak michalkvasnicak merged commit 8dbe504 into michalkvasnicak:master Aug 2, 2016
@michalkvasnicak
Copy link
Owner

@themouette thank you 👍

@michalkvasnicak
Copy link
Owner

Released as 0.2.0

@themouette
Copy link
Author

\o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants